<?php
class YearAction extends Action{
    public function year(){
        $this->display();
    }

    public function doYear(){
        $grade=$_POST['grade'];
        $m = M('Student');
        echo "$grade"."年级的学生有：";
        //$arr=$date->select();
        if($grade == "所有"){
            $arr=$m->select();
        }else{
            if(date('m') < 8) {
                $date = C('DATE')-$grade;
                $arr=$m->where("updatetime = $date")->order('updatetime ,stu_id')->select();
            }else{
                $date = C('DATE')-$grade+1;
                $arr=$m->where("updatetime = $date")->order('updatetime ,stu_id')->select();
            }
        }

        //$arr['grade_'] = C('DATE') - 
        $this->assign('data',$arr);
        $this->display();

    }

}
?>
